home *** CD-ROM | disk | FTP | other *** search
- #ifndef lint
- static char rcsid[] = "$Header: pawntries.c,v 1.3 87/02/12 13:23:56 schoch Exp $";
- #endif
-
- /* "pawntries.c */
- #include "externs.h"
-
- countpawntries (color)
- u_char color;
- {
- LIST l, moves, piecemoves ();
- int tries, /* move,*/ start, end;
-
- tries = 0;
- l = piecelocs [color];
- while (l != NIL) {
- start = l->i;
- l = l->n;
- if (occupant [start] != PAWN)
- continue;
- moves = piecemoves (start, FALSE);
- while (moves != NIL) {
- end = moves->i;
- moves = moves->n;
- if (start % 10 == end % 10)
- continue;
- if (moveintocheck (start, end))
- continue;
- tries++;
- }
- }
- return tries;
- }
-
-
- findvictim (from, to)
- int from, to;
- {
- if (occupant [from] == PAWN) {
- if (from % 10 == to % 10)
- return FALSE;
- if (whose [to] == 1 - whose [from])
- return to;
- else
- return (to - pawndir [whose [from]]); /* en passent */
- } else {
- if (whose [to] == 1 - whose[from])
- return to;
- else
- return FALSE;
- }
- }
-